//字母大小写全排列

class Solution {
    vector<string> ret; 
    string path;
public:
    vector<string> letterCasePermutation(string s) {
        dfs(s, 0);
        return ret;
    }
    void dfs(string s, int pos)
    {
        if(pos == s.size()) 
        {
            ret.push_back(path);
            return;
        }
        //不变
        path.push_back(s[pos]);
        dfs(s, pos + 1);
        path.pop_back();
        //变换
        if(s[pos] < '0' || s[pos] > '9')
        {
            if(s[pos] >= 'a' && s[pos] <= 'z')
            {
                path.push_back(s[pos] - 32);
                dfs(s, pos + 1);
                path.pop_back();
            }
            else
            {
                path.push_back(s[pos] + 32);
                dfs(s, pos + 1);
                path.pop_back();
            }
        }
    }
};